linux 的文件管理器、命令行下,用 emacs 快速打开文件的方法 |
您所在的位置:网站首页 › emacs 命令行 › linux 的文件管理器、命令行下,用 emacs 快速打开文件的方法 |
linux 的文件管理器、命令行下,用 emacs 快速打开文件的方法
by
贤民
2018-05-22
(上次更新:
2018-07-30)
计算机
首先要确认 emacs 已经启动,并且开启了 server 1 。如果使用 spacemacs ,server 默认是开启的。这样就可以使用 emacsclient 命令快速打开文件了。 命令行下使用 emacsclient直接添加一条 alias : 1 alias ec="emacsclient -nq"参数 nq 的含义是: -n, --no-wait Don't wait for the server to return -q, --quiet Don't display messages on success以后在命令行中用 emacs 打开文件,只需要敲击 ec 文件名 即可。 在文件管理器下,右键菜单打开文件我的方法是: 在 ~/.local/share/applications/ 目录下,添加一个 emacs.desktop 文件。编辑这个 desktop 文件: [Desktop Entry] Version=1.0 Name=Edit with Emacs GenericName=Text Editor MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; Exec=/usr/bin/emacsclient -nq %F Icon=emacs25 Type=Application Terminal=false Categories=Utility;Development;TextEditor; Keywords=Text;Editor;这样我们就添加了一个名为 Edit with Emacs 的程序,同时在文件管理器中,就可以用这个程序打开文件了。并且可以为特定的后缀,比如 .org 文件,设置 默认打开程序 为 Edit with Emacs 。 Emacs Server - GNU Emacs Manual ↩︎ 文章作者 贤民 上次更新 2018-07-30 (64fea94) fix 许可协议 原创文章,如需转载请注明文章作者和出处。谢谢! emacs linux tip |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |